//
// Created by ych on 2/13/24.
//

#ifndef MATINTERPRETER_READER_H
#define MATINTERPRETER_READER_H

#include "../common/ych_object.h"

typedef struct YState YState;
typedef struct YReader {
    YState *y_state;
    char *file_path;
    char *ch;
    size_t pos;
    size_t line;
    size_t line_start_pos;
    String file_text;
} Reader;

void initReader1(Reader *reader, YState *y_state);
void initReader2(Reader *reader, YState *y_state, char *file_path);
void readLine(Reader *reader, char *buffer);
void readFile(Reader *reader);
char getChar(Reader *reader);
void nextChar(Reader *reader);
void toStatementEnd(Reader *reader);
void rollbackReader(Reader *reader);
void freeReader(Reader *reader);
void readerThrow(Reader *reader);

#endif //MATINTERPRETER_READER_H
